﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;

namespace LowLevelGraphics.Histograms
{
    /// <summary>
    /// May contain different histogramms in a grid like manner for each bitmap
    /// </summary>
    public class HistogramArray : List<Histogram>
    {
        private Bitmap m_WorkingBitmap = null;
        private int m_nXStep = 1;
        private int m_nYStep = 1;
        public HistogramArray(Bitmap bitmap, int _nXStep, int _nYStep)
        {
            m_WorkingBitmap = bitmap;
        }

        public void Create()
        {
            this.Clear();
            Histogram histogram = null;

            int nHeight = m_WorkingBitmap.Height;
            int nWidth = m_WorkingBitmap.Width;

            for (int y = 0; y < nHeight; y += m_nYStep)
            {
                for (int x = 0; x < nWidth; x++)
                {
                    histogram = new Histogram(10, m_WorkingBitmap, new Rectangle(x, y, m_nXStep, m_nYStep), 1, 1);
                    this.Add(histogram);
                }
            }
        }
    }
}
